package com.bdqn.wang.service.impl;

import com.bdqn.wang.UserPage.Page;
import com.bdqn.wang.dao.Menberinfodao;
import com.bdqn.wang.dao.impl.MenberinfodaoImpl;
import com.bdqn.wang.pojo.Menber;
import com.bdqn.wang.service.MenberService;
import com.bdqn.wang.service.UserService;
import com.sun.org.apache.xpath.internal.compiler.Keywords;

import java.util.List;

public class MenberServiceImpl implements MenberService{
    Menberinfodao userinfodao=new MenberinfodaoImpl();
    @Override
    public List<Menber> getAll() {
        return userinfodao.getAll();
    }

    @Override
    public int add(Menber user) {
        return userinfodao.add(user);
    }

    @Override
    public int delet(int id) {
        return userinfodao.delet(id);
    }

    @Override
    public int update(Menber user) {
        return userinfodao.update(user);
    }

    @Override
    public Menber getOne(int id) {
        return userinfodao.getOne(id);
    }

    @Override
    public Page getAllByPage(int currentPage) {
        int count=userinfodao.count();

        List<Menber>keywordsList=userinfodao.getAllByPage(currentPage);
        Page page=new Page();
        page.setCurrentPage(currentPage);
        page.setTotalCount(count);
        page.setTotalPage();
        page.setList(keywordsList);
        return page;
    }

}
